package com.zuihai.app.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.zuihai.app.mvp.contract.DetailRecommendContract;
import com.zuihai.app.mvp.model.api.service.DetailService;
import com.zuihai.app.mvp.model.entity.AliPayResponse;
import com.zuihai.app.mvp.model.entity.BaseMainClass;
import com.zuihai.app.mvp.model.entity.MessageResponse;
import com.zuihai.app.mvp.model.entity.WXPayResponse;
import com.zuihai.app.mvp.ui.utils.UserDataUtils;

import javax.inject.Inject;

import rx.Observable;

/**
 * Created by Administrator on 2017/6/6 0006.
 */

@FragmentScope
public class DetailRecommendModel extends BaseModel implements DetailRecommendContract.Model {
    private Gson mGson;
    private Application mApplication;
    private DetailService mDetailService;

    @Inject
    public DetailRecommendModel(IRepositoryManager repositoryManager, Gson gson, Application application) {
        super(repositoryManager);
        this.mGson = gson;
        this.mApplication = application;
        mDetailService = repositoryManager.obtainRetrofitService(DetailService.class);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<MessageResponse> recommentOrder(String type,String id, String userId, int recomentDay, int favourCount, double favourMoney, int shareCount, double shareMoney,double tuijianPrice,int threePay,int threeType) {
        return mDetailService.recommenOrder(type,id, userId, recomentDay, favourCount, favourMoney, shareCount,
                shareMoney,tuijianPrice,threePay,threeType);
    }

    @Override
    public Observable<WXPayResponse> requestWechatBuyPayTuijian(String orderContent, String price, String type, String id, String userId, int recomentDay, int favourCount, double favourMoney, int shareCount, double shareMoney, double tuijianPrice, int threePay, int threeType) {
        return mDetailService.weixin_Pay_TuijianInq(orderContent, price,UserDataUtils.getUserID(),type,id, userId, recomentDay, favourCount, favourMoney, shareCount,
                shareMoney,tuijianPrice,threePay,threeType,4);
    }

    @Override
    public Observable<AliPayResponse> requestAliBuyPayTuijian(String orderContent, String price, String orderName, String type, String id, String userId, int recomentDay, int favourCount, double favourMoney, int shareCount, double shareMoney, double tuijianPrice, int threePay, int threeType) {
        return mDetailService.requestAliBuyPayTuijian(orderContent, price, orderName, UserDataUtils.getUserID(),
                type,id, userId, recomentDay, favourCount, favourMoney, shareCount,
                shareMoney,tuijianPrice,threePay,threeType,4);
    }

    @Override
    public Observable<WXPayResponse> requestWechatPay(String orderContent, String price) {
        return mDetailService.requestWechatPay(orderContent, price);
    }




    @Override
    public Observable<AliPayResponse> requestAliPay(String orderContent, String price, String orderName) {
        return mDetailService.requestAliPay(orderContent, price, orderName);
    }



    @Override
    public Observable<BaseMainClass> walletPay(String myId, String friendId, String _price, String buyName, String type) {
        return mDetailService.walletPay(myId,friendId,_price,buyName,type);
    }

    @Override
    public Observable<BaseMainClass> tuijianPrice() {
        return mDetailService.tuijianPrice("-1");
    }
}
